/* 好友页面专用样式 */

/* 侧边栏样式 */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    visibility: hidden;
    opacity: 0;
    transition: all 0.3s ease;
}

.sidebar.active {
    visibility: visible;
    opacity: 1;
}

.sidebar-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.sidebar-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 280px;
    height: 100%;
    background: linear-gradient(135deg, rgba(13, 17, 23, 0.95), rgba(22, 27, 34, 0.95));
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.3);
}

.sidebar.active .sidebar-content {
    transform: translateX(0);
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(22, 27, 34, 0.8);
}

.sidebar-header h3 {
    color: #f0f6fc;
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.sidebar-close {
    background: none;
    border: none;
    color: #8b949e;
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.sidebar-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #f0f6fc;
}

.sidebar-nav {
    padding: 20px 0;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #c9d1d9;
    text-decoration: none;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #f0f6fc;
    border-left-color: rgba(31, 111, 235, 0.5);
}

.sidebar-link.active {
    background: rgba(31, 111, 235, 0.1);
    color: #58a6ff;
    border-left-color: #1f6feb;
}

.sidebar-link i {
    width: 20px;
    margin-right: 12px;
    font-size: 16px;
    text-align: center;
}

.sidebar-link span {
    font-weight: 500;
}

/* 防止页面滚动 */
body.sidebar-open {
    overflow: hidden;
}

/* 主内容区 */
.main-content {
    background: rgba(13, 17, 23, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    backdrop-filter: blur(10px);
    padding: 20px;
    min-height: calc(100vh - 120px);
    margin: 20px;
}

/* 选项卡 */
.tab-bar {
    display: flex;
    background: rgba(22, 27, 34, 0.8);
    border-radius: 12px;
    margin-bottom: 20px;
    padding: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.tab-btn {
    flex: 1;
    padding: 10px 16px;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: 8px;
    font-weight: 500;
    color: #c9d1d9;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    background: #1f6feb;
    color: white;
}

/* 好友页面特有的搜索框样式 */
.main-content .search-container {
    width: 100%;
    position: relative;
    margin-bottom: 22px;
}

/* 好友列表 */
.friends-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* 好友项 */
.friend-item {
    background: rgba(22, 27, 34, 0.8);
    padding: 16px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.2s ease;
}

.friend-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
    border-color: rgba(255, 255, 255, 0.15);
}

.avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.friend-info {
    flex: 1;
    min-width: 0;
}

.username {
    font-size: 16px;
    font-weight: 600;
    color: #e6edf3;
    margin-bottom: 4px;
}

.user-title {
    font-size: 13px;
    color: #8b949e;
    margin: 0;
}

/* 操作按钮 */
.friend-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-chat {
    background: rgba(31, 111, 235, 0.1);
    color: #58a6ff;
    border: 1px solid rgba(31, 111, 235, 0.3);
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-chat:hover {
    background: rgba(31, 111, 235, 0.2);
    border-color: #1f6feb;
}

.btn-more {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #8b949e;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-more:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #e6edf3;
    border-color: rgba(255, 255, 255, 0.2);
}

/* 申请列表 */
.requests-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.request-item {
    background: rgba(22, 27, 34, 0.8);
    padding: 16px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.2s ease;
}

.request-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
    border-color: rgba(255, 255, 255, 0.15);
}

.request-info {
    flex: 1;
    min-width: 0;
}

.request-meta {
    font-size: 13px;
    color: #8b949e;
    margin: 0 0 4px 0;
}

.request-msg {
    font-size: 14px;
    color: #c9d1d9;
    margin: 0;
}

.request-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn-accept {
    background: rgba(46, 160, 67, 0.1);
    color: #2ea043;
    border: 1px solid rgba(46, 160, 67, 0.3);
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-accept:hover {
    background: rgba(46, 160, 67, 0.2);
    border-color: #2ea043;
}

.btn-reject {
    background: rgba(248, 81, 73, 0.1);
    color: #f85149;
    border: 1px solid rgba(248, 81, 73, 0.3);
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-reject:hover {
    background: rgba(248, 81, 73, 0.2);
    border-color: #f85149;
}

/* 搜索推荐部分 */
.search-section h3 {
    color: #e6edf3;
    margin-bottom: 16px;
    font-size: 16px;
}

.users-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.user-card {
    background: rgba(22, 27, 34, 0.8);
    padding: 16px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.2s ease;
}

.user-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
    border-color: rgba(255, 255, 255, 0.15);
}

.user-card .avatar {
    width: 64px;
    height: 64px;
    margin: 0 auto 8px;
}

.user-tags {
    font-size: 13px;
    color: #8b949e;
    margin: 8px 0;
}

.btn-add {
    background: rgba(31, 111, 235, 0.1);
    color: #58a6ff;
    border: 1px solid rgba(31, 111, 235, 0.3);
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 100%;
    margin-top: 8px;
}

.btn-add:hover {
    background: rgba(31, 111, 235, 0.2);
    border-color: #1f6feb;
}

/* 搜索结果 */
.result-item {
    background: rgba(22, 27, 34, 0.8);
    padding: 16px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.2s ease;
}

.result-info {
    flex: 1;
    min-width: 0;
}

/* 底部导航 */
.bottom-nav {
    background: rgba(13, 17, 23, 0.9);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-around;
    padding: 12px 0;
    backdrop-filter: blur(10px);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #8b949e;
    font-size: 12px;
    padding: 8px;
    gap: 4px;
    transition: all 0.2s;
    border-radius: 8px;
}

.nav-item:hover {
    color: #c9d1d9;
}

.nav-item.active {
    color: #58a6ff;
}

.nav-item i {
    font-size: 18px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .main-content {
        margin: 10px;
        padding: 16px;
    }

    .friend-item,
    .request-item,
    .result-item {
        padding: 12px;
        gap: 12px;
    }

    .avatar {
        width: 48px;
        height: 48px;
    }

    .username {
        font-size: 15px;
    }

    .friend-actions,
    .request-actions {
        flex-direction: column;
        gap: 6px;
    }

    .btn-chat,
    .btn-accept,
    .btn-reject,
    .btn-add {
        padding: 4px 10px;
        font-size: 12px;
    }

    .btn-more {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }

    .users-grid {
        grid-template-columns: 1fr;
    }

    .user-card .avatar {
        width: 56px;
        height: 56px;
    }
}

/* 聊天界面专用样式 */
.chat-container {
    display: none;
}

.chat-main-content {
    margin: 20px auto;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 120px);
}

.chat-header {
    display: flex;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 20px;
    flex-shrink: 0;
}

.btn-back-to-friends {
    background: rgba(31, 111, 235, 0.1);
    color: #58a6ff;
    border: 1px solid rgba(31, 111, 235, 0.3);
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-back-to-friends:hover {
    background: rgba(31, 111, 235, 0.2);
    border-color: #1f6feb;
}

.chat-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: 20px;
}

.chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.chat-user-details h3 {
    font-size: 16px;
    font-weight: 600;
    color: #e6edf3;
    margin-bottom: 4px;
}

.chat-user-status {
    font-size: 13px;
    color: #2ea043;
    margin: 0;
}

.chat-messages-container {
    flex: 1;
    overflow-y: scroll;
    padding: 0 0px 20px 0;
    /* 美化滚动条 */
    scrollbar-width: thin;
    scrollbar-color: rgba(136, 136, 136, 0.5) transparent;
}

/* Webkit浏览器滚动条美化 */
.chat-messages-container::-webkit-scrollbar {
    width: 6px;
}

.chat-messages-container::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 3px;
}

.chat-messages-container::-webkit-scrollbar-thumb {
    background: rgba(136, 136, 136, 0.5);
    border-radius: 3px;
    min-height: 20px;
    /* 设置滚动条最小高度 */
}

.chat-messages-container::-webkit-scrollbar-thumb:hover {
    background: rgba(136, 136, 136, 0.7);
}

.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 16px;
    /* 为滚动条预留空间 */
    padding-right: 10px;
}

.message {
    display: flex;
    gap: 12px;
    max-width: 80%;
}

.message.received {
    align-self: flex-start;
}

.message.sent {
    align-self: flex-end;
    margin-left: auto;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.message-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.message.received .message-content {
    background: rgba(22, 27, 34, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px 18px 18px 4px;
    padding: 12px 16px;
}

.message.sent .message-content {
    background: rgba(31, 111, 235, 0.1);
    border: 1px solid rgba(31, 111, 235, 0.3);
    border-radius: 18px 4px 18px 18px;
    padding: 12px 16px;
}

.message-content p {
    color: #e6edf3;
    font-size: 14px;
    margin: 0;
    word-wrap: break-word;
}

.message-time {
    font-size: 11px;
    color: #8b949e;
    align-self: flex-end;
}

.chat-input-area {
    display: flex;
    gap: 12px;
    padding: 20px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    background: rgba(22, 27, 34, 0.8);
    color: #e6edf3;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
}

.chat-input:focus {
    border-color: #1f6feb;
    box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.3);
}

.btn-send {
    background: rgba(31, 111, 235, 0.1);
    color: #58a6ff;
    border: 1px solid rgba(31, 111, 235, 0.3);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-send:hover {
    background: rgba(31, 111, 235, 0.2);
    border-color: #1f6feb;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .chat-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .chat-user-info {
        margin-left: 0;
    }

    .message {
        max-width: 90%;
    }

    .chat-input-area {
        padding: 16px 0;
    }
}